package com.shen.utils;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
 * hbm2ddl工具类，根据实体类和hibernate配置生成数据库表
 * 
 * @author shen
 *
 */
public class ExportDbUtils {
	
	public static void export(){
		//读取hibernate.cfg.xml文件
		Configuration cfg = new Configuration().configure();
		//调用实体类SchemaExport创建表
		SchemaExport export = new SchemaExport(cfg);
		//生成表
		export.create(true, true);
	}
	
	public static void main(String[] args){
		ExportDbUtils.export();
	}
}
